<?php

declare(strict_types=1);
/**
 * This file is part of Hyperf.
 *
 * @link     https://www.hyperf.io
 * @document https://hyperf.wiki
 * @contact  group@hyperf.io
 * @license  https://github.com/hyperf/hyperf/blob/master/LICENSE
 * @author   howe <howe1995@163.com>
 */
use Hyperf\Database\Migrations\Migration;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Schema\Schema;

return new class() extends Migration {
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('exception_logs', function (Blueprint $table) {
            $table->id()->unsigned();
            $table->string('env')->default('')->comment('部署环境');
            $table->string('project')->default('')->comment('项目名称');
            $table->string('url')->default('')->comment('请求地址');
            $table->string('request_ip', 50)->default('')->comment('请求ip');
            $table->string('request_id', 50)->nullable()->comment('请求id');
            $table->longText('exception')->comment('异常信息');
            $table->timestamp('created_at')->useCurrent();
            $table->comment('异常日志');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('exception_logs');
    }
};
